package com.zhuoyue.biz.core.command.cmd.common.fac;

import com.zhuoyue.biz.core.api.domain.DeviceAndGatewayDO;
import com.zhuoyue.biz.core.api.dto.req.ControlReq;
import com.zhuoyue.biz.core.command.cmd.common.fac.base.BaseCmd;
import com.zhuoyue.biz.core.command.cmd.common.fac.base.IndexType0Fac0202;
import com.zhuoyue.common.constant.ControlType;

/**
 * 空调面板
 * @author Administrator
 */
public class KongTiaoMianBan0Fac0202 {


    public static String control(DeviceAndGatewayDO deviceAndGatewayDO, ControlReq controlReq) {
        String cmd = "";
        cmd = BaseCmd.control(deviceAndGatewayDO, controlReq);
        switch (controlReq.getControlType()) {
            //温度
            case ControlType.INCREMENT_TEMPERATURE_REQUEST:
                int temperatureVlue = controlReq.getActions().get("temperature") == null ? 26 : (int) controlReq.getActions().get("temperature");
                cmd = BaseCmd.getControlCmd(deviceAndGatewayDO, temperature(temperatureVlue));
                break;
            default:
                break;

        }
        return cmd;
    }

    /**
     * 温度设置
     */
    public static String temperature(int temperature) {
        return IndexType0Fac0202.TEMPERATURE + "00" + temperature;
    }

}
